<style lang="less">
  #div_truck_load_earnest_select_dialog {
  }
</style>

<template>
  <div id="div_truck_load_earnest_select_dialog">
    <el-dialog title="销账记录" :visible.sync="isShow" width="30%">
      <el-form ref="truckLoadEarnestCancelAccountForm" :model="truckLoadEarnestCancelAccountForm" label-width="100px">
        <el-form-item label="销账金额">
          <el-input class="f-w70" v-model="truckLoadEarnestCancelAccountForm.price" disabled></el-input>
        </el-form-item>
        <el-form-item label="付款时间">
          <el-input class="f-w70" v-model="truckLoadEarnestCancelAccountForm.paymentDate" disabled></el-input>
        </el-form-item>
        <el-form-item label="到账银行">
          <el-input class="f-w70" v-model="truckLoadEarnestCancelAccountForm.toBank" disabled></el-input>
        </el-form-item>
        <el-form-item label="银行卡号">
          <el-input class="f-w70" v-model="truckLoadEarnestCancelAccountForm.bankCardNumber" disabled></el-input>
        </el-form-item>
        <el-form-item label="银行流水号">
          <el-input class="f-w70" v-model="truckLoadEarnestCancelAccountForm.bankNumber" disabled></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input class="f-w70" type="textarea" v-model="truckLoadEarnestCancelAccountForm.remark"
                    disabled></el-input>
        </el-form-item>
        <el-form-item label="交易凭证">
          <img width="40%" v-for="image in truckLoadEarnestCancelAccountForm.imageList" v-bind:src="image">
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import { isEmpty, resetForm } from '../../lib/util.js';
import { searchTruckLoadEarnestCancelAccount } from '../../api/order/TruckLoadEarnest.js';

export default {
  name: 'TruckLoadEarnestSelectDialog',
  props: {
    selectTruckLoadEarnest: {}
  },
  watch: {
    selectTruckLoadEarnest (val) {
      resetForm(this.$refs.truckLoadEarnestCancelAccountForm, this.truckLoadEarnestCancelAccountForm);
      let model = JSON.parse(val);
      if (isEmpty(model) || isEmpty(model.id)) {
        return;
      }
      searchTruckLoadEarnestCancelAccount({
        filters: 'EQ_truckLoadManage.id=' + model.id,
        sorts: '-createDate',
        size: 1,
        page: 1
      }).then((res) => {
        console.log(res.data);
        this.truckLoadEarnestCancelAccountForm = res.data.detailModelList[0];
      });
      this.isShow = model.isShow;
    }
  },
  data () {
    return {
      isShow: false,
      truckLoadEarnestCancelAccountForm: {
        price: '',
        paymentDate: '',
        toBank: '',
        bankCardNumber: '',
        bankNumber: '',
        remark: '',
        images: '',
        paymentType: '',
        paymentTypeName: '',
        truckLoadManage: {}
      }
    };
  },
  methods: {},
  mounted () {}
};
</script>
